import React from 'react';
import { inject, observer } from 'mobx-react';
import { WeaBrowser, WeaLocaleProvider } from 'ecCom';
import {WeaForm} from '../../../../pc4mobx/coms/wea-form';
import { toJS } from 'mobx';
import { Row, Col } from 'antd';
const getLabel = WeaLocaleProvider.getLabel;

@inject('docCenterStore')

@observer
class UploadFile extends React.Component {
  constructor(props){
    super(props);
    this.state={
      browser: {
        type: 9,
        title: getLabel(385103,'可新建文档的目录'),
        icon: 'icon-coms-doc',
        iconBgcolor: '#F14A2D',
        inputStyle: {
          width: '517px',
          height: '39px',
          marginTop:'32px',
          marginLeft: '30px',
        },
        tabs:[
          {key: '1', name: getLabel(385079,'全部目录'), url: '/api/workflow/browser01/data/doccategory',dataParams:{iscreate:1,isFav:0,isCommon:0} },
          {key: '2', name: getLabel(18030, '我的收藏'), url: '/api/workflow/browser01/data/doccategory' ,dataParams:{iscreate:1,isFav:1, isCommon:0} },
          {key: '3', name: getLabel(28183,'常用目录'), url: '/api/workflow/browser01/data/doccategory' ,dataParams:{iscreate:1,isFav:0, isCommon:1} },
        ],
        quickSearchName : 'name',
      },
      isShowCheckInfo: false,
    };
  }
  componentDidMount() {
  }
  componentWillReceiveProps() {
  }
  componentWillUnmount() {
  }
  render() {
    const { browser } = this.state;
    const { isShowCheckInfo, onChange, setCategory } = this.props;
    return (
      <div>
        <Row>
          <Col span={22}>
            <WeaBrowser {...browser} onChange = {(ids, names, datas) => {
                if(ids === ''){
                  onChange(false);
                } else {
                  onChange(true);
                  setCategory(ids);
                }
            }} />
          </Col>
          <Col span={2}>
            {!isShowCheckInfo && (<div className="centerleft-upload-mark">*</div> )}
          </Col>
        </Row>
        {
          !isShowCheckInfo ? (
          <div className="centerleft-upload-tip">{getLabel(33252, '请先选择目录')}</div>) : (
          <div className="centerleft-upload-tipl">{getLabel(385109,"此目录下最大上传100M/个的附件")}</div> )
        }
      </div>
    );
  }
}
export default UploadFile;
